package com.mvvm.store.roombatabase;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.mvvm.store.bean.basebean.MaterialInfoBean;
import com.mvvm.store.bean.basebean.StockUpInfoBean;

    @Database(entities = {StockUpInfoBean.class},version=1,exportSchema = false)
    public abstract class  StoreHouseDatabase extends RoomDatabase {

    private static final String DB_NAME = "StockUpDatabase.db";
    private static volatile StoreHouseDatabase instance;

    public static synchronized StoreHouseDatabase getInstance(Context context) {
        if (instance == null) {
            instance = create(context);
        }
        return instance;
    }

    private static StoreHouseDatabase create(final Context context) {
        return Room.databaseBuilder(

                context,
                StoreHouseDatabase.class,
                DB_NAME)
                .allowMainThreadQueries()
                .build();

    }



    public abstract StockUpInfoDao stockUpDao();



}
